package com.demo.webflux.domain;

import java.io.Serializable;
import java.util.List;

import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

@Document(collection = "book")
public class Book implements Serializable {

	/**
	 *
	 */
	private static final long serialVersionUID = 3909132553758730806L;
	@Id
	private ObjectId id;
	@Indexed
	private String title;
	@Indexed
	private List<String> authors;
	@Field("pubYear")
	private Integer publishYear;

	public Book() {
		super();
	}
	public Book(String title, List<String> authors, Integer publishYear) {
		super();
		this.title = title;
		this.authors = authors;
		this.publishYear = publishYear;
	}
	@Override
	public String toString() {
		return "Book [id=" + id + ", title=" + title + ", authors=" + authors + ", publishYear=" + publishYear + "]";
	}
	public ObjectId getId() {
		return id;
	}
	public void setId(ObjectId id) {
		this.id = id;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public List<String> getAuthors() {
		return authors;
	}
	public void setAuthors(List<String> authors) {
		this.authors = authors;
	}
	public Integer getPublishYear() {
		return publishYear;
	}
	public void setPublishYear(Integer publishYear) {
		this.publishYear = publishYear;
	}

}
